Page({
  data: {
    showUrl: "",
    canUse: true,
  },
  onLoad() {
    // 高通过率也可租机
    let time = new Date().getTime()
    this.data.showUrl = `https://hakey168888.gitee.io/testpage/?id=${time}`;
  },

  onUnload() {
    let pages = getCurrentPages(); // 当前页面
    let beforePage = pages[pages.length - 2]; // 上一页

    if(beforePage) {
      beforePage.jumpNoSesameRentMachine()
      beforePage.setData({
        noJumpH5Page: true
      })
    }
  },
 
  onMessage(e) {
    const { id, appid: appId } = e.detail

    if(appId) {
      my.navigateToMiniProgram({
        appId,
        "path": `pages/product/detail/detail?id=${id}&ss=da28a177700a4ef2a44edc8e6e44411d`,
        "fail": (res) => {
          if (res.error == 30) {
            my.alert({
              content: '目标小程序设置了不允许跳转'
            });
          } else {
            my.showToast({
              content: '跳转失败'
            });
          }
        }
      });
    }
  }
});
